﻿using System;
using System.Collections.Generic;

using RexToy.UI.WinForm.Controls;
using RexToy.UI.WinForm;

namespace UnitTest.WinForm.SampleControl
{
    public class TestComboBoxForm : Form
    {
        [PmlxBoundControl]
        public DataComboBox cmbBindClass;
        [PmlxBoundControl]
        public DataComboBox cmbBindClassEntity;
        [PmlxBoundControl]
        public DataComboBox cmbBindStruct;
        [PmlxBoundControl]
        public EnumComboBox cmbBindEnum;

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            cmbBindEnum.Bind<DataExchangeType>();

            var list = new List<Model.Person>() {
                new Model.Person {ID = 1, Name = "A", Gender = true , Birth= DateTime.Parse("2000-1-1")},
                new Model.Person {ID = 2, Name = "B", Gender = false, Birth = DateTime.Parse("2003-5-5")}
            };
            cmbBindClass.Bind(list);
            cmbBindClassEntity.Bind(list);

            var l = new List<int>(){
                1,2,3,4,5
            };
            cmbBindStruct.Bind(l);
        }
    }
}
